package com.jason.www.state_pattern.demo1.state;


import com.jason.www.state_pattern.demo1.context.RoomContext;

/**
 *  房间空闲状态
 */
public class RoomFreeTimeState implements IRoomState{

    private RoomContext context;

    public RoomFreeTimeState(RoomContext context) {
        this.context = context;
    }

    @Override
    public void bookRoom() {
        System.out.println("您已经成功预订了...");
        context.setState(context.getBookedState());
    }

    @Override
    public void unsubscribeRoom() {
        //不需要做操作
        throw new RuntimeException("不需要做操作，执行退订操作失败");
    }

    @Override
    public void checkInRoom() {
        //不需要做操作
        System.out.println("不需要做操作，执行checkIn操作失败");
        throw new RuntimeException("不需要做操作，执行checkIn操作失败");
    }

    @Override
    public void checkOutRoom() {
        //不需要做操作
        throw new RuntimeException("不需要做操作，执行退房操作失败");
    }
}
